<?php
/**
 * Created by PhpStorm.
 * User: tangchao
 * Date: 19-4-20
 * Time: 下午2:35
 */

namespace Lib;

//事件发生者基类
abstract class EventGenerayot
{
    private $observers = [];
    //添加观察者
    function addObserver(Observer $observer){
        $this->observers[] = $observer;
    }

    //通知
    function notify(){
        foreach ($this->observers as $observer) {
            $observer->update();
        }
    }

}